package com.alt.www.sort;

import lombok.Data;

/**
 * Created by wangyang on 2017/8/3.
 */
@Data
public class Date implements Comparable<Date>{
    private int year;
    private int month;
    private int day;
    public Date(int year, int month, int day){
        this.year = year;
        this.month = month;
        this.day = day;
    }

    @Override
    public int compareTo(Date o) {
        if(year>o.year){
            return 1;
        }
        if(year<o.year){
            return -1;
        }
        if(month>o.month){
            return  1;
        }
        if(month<o.month){
            return  -1;
        }
        if(day>o.day){
            return  1;
        }
        if(day<o.day){
            return  -1;
        }
        return 0;
    }

    public String toString(){
        return " year : " + year + " month : " + month + " day : "+day;
    }
}
